IF EXISTS(SELECT * FROM sysobjects WHERE name = 'obtenerUltimoHastaGeomecanica' AND type = 'P')
BEGIN
	DROP PROCEDURE obtenerUltimoHastaGeomecanica
END
GO
CREATE PROCEDURE obtenerUltimoHastaGeomecanica
(
@CodigoSondaje INT
)
AS
/*********************************************************************
	Resumen: Genera codigo de Sondaje
	Parametros: @CodigoSondaje Codigo de Sondaje
**********************************************************************/		

BEGIN

	DECLARE @Hasta FLOAT
	SET @Hasta = 0
	SELECT @Hasta = isnull(t1.Hasta, 0) FROM Geomecanica t1 WHERE t1.CodigoSondaje = @CodigoSondaje
	SELECT @Hasta AS Hasta
END
-- obtenerUltimoHastaGeomecanica 1